package com.atguigu.spzx.manager.service.impl;


import com.atguigu.spzx.manager.mapper.SysRoleMapper;
import com.atguigu.spzx.manager.service.SysRoleService;
import com.atguigu.spzx.model.dto.system.SysRoleDto;
import com.atguigu.spzx.model.entity.system.SysRole;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRoleServiceImpl  implements SysRoleService {
    @Autowired
    private SysRoleMapper sysRoleMapper;

    @Override
    public PageInfo<SysRole> findByPage(SysRoleDto sysRoleDto, Integer current , Integer limit){
        PageHelper.startPage(current,limit);
        List<SysRole> list=sysRoleMapper.findByPage(sysRoleDto);
        PageInfo<SysRole> pageInfo=new PageInfo<>(list);

        return  pageInfo;
    }

    @Override
    public  Boolean roleAdd(SysRole sysRole){
      return   sysRoleMapper.save(sysRole);
    }
    @Override
    public  Boolean roleDel(long id){
        return  sysRoleMapper.delete(id);
    }

    @Override
    public  Boolean update(SysRole sysRole){
        return  sysRoleMapper.update(sysRole);
    }
}
